#include<iostream>
using namespace std;
int	n, a, b, c;
int main()
{
	cin >> n >> a >> b >> c;
	int ans = 0;
	for (int i = 0; i <= n / a; i++) {
		for (int j = 0; j <= n / b; j++) {
			int k = n - i * a - j * b;
			if (k < 0)continue;
			if (k % c == 0) {
				ans = max(i + j + k / c, ans);
			}
			/*int cnt = k / c;
			if (cnt * c + i * a + j * b == n) {
				ans = max(i + j + cnt, ans);
			}*/
		/*	cout << "k==" << k << endl;
			cout << "i==" << i << " j==" << j << " cnt==" << cnt << endl;*/
		}
	}
	cout << ans << endl;
	return 0;
}